package org.dromara.system.util;

import org.dromara.common.core.constant.Constants;
import org.dromara.common.redis.utils.RedisUtils;

public class VerifyCodeUtil {

    public static void verifyInsertBankCode(String reservedPhone, String code) {
        String key = Constants.VERIFYCODE + Constants.ADDBANK + reservedPhone;
        if (!RedisUtils.hasKey(key)){
            throw new RuntimeException("验证码已过期");
        }
        if (!RedisUtils.getCacheObject(key).equals(code)){
            throw new RuntimeException("验证码错误");
        }
    }
}
